const OP = Object.prototype;
export class Jsonb {
    constructor(obj, callback) {
        if (OP.toString().call(obj) !== '[object Object]') {
            console.error('not an obj')
        }
        this.$callback = callback;
        this.observe(obj);
    }
    observe(obj) {
        Object.keys(obj).forEach((key, index, keyArr)=>{
        	var val = obj[key];
        	Object.defineProperty(obj, key, {
        		get(){
        			return val;
        		},
        		set(newVal){
        			this.$callback(newVal);
        		}
        	})
        })
    }
}